Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Adding "/" and "-" chars for the new condition format #193

Closed
wants to merge 2 commits into from

Conversation

didierofrivia
Copy link
Contributor

@didierofrivia didierofrivia commented Jul 26, 2023

This PR addresses the need to change the new condition format introduced RLP V2 in Kuadrant

@didierofrivia didierofrivia marked this pull request as ready for review July 26, 2023 10:44
@@ -613,7 +613,7 @@ mod conditions {

fn valid_id_char(&mut self) -> bool {
let char = self.input[self.pos];
char.is_alphanumeric() || char == '.' || char == '_'
char.is_alphanumeric() || char == '.' || char == '_' || char == '-' || char == '/'
Copy link
Member

@alexsnaps alexsnaps Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the trouble I have with this change is that it muddies the waters... What if it's to be an expression now? Like http.response_code - 12 ? The white spaces matter now?
That being said I don't think we'd ever support that (very example if only 🤣 ). That being said I already hated having the . in there... tho I thought you could have argued it remained an identifier for "something" to resolve...

So anyways, I won't necessarily block this from happening, but I wonder if sanitizing the variable names/identifiers wouldn't be slightly more desirable.

Copy link
Contributor

@guicassolato guicassolato Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t necessarily need - nor /. Intuitively, we went with these characters because the Limitador identifiers that the RateLimitPolicy controller generates come straight from qualified limit definitions stated in Kubernetes resources, where the / char is used as the namespace-resource separator and the - char is often used in the names of the resources. We first thought that by keeping such format we'd favour readability (even though we’re here talking about internal values of internal resources that hardly will be inspected by humans).

In the end, all we need are unique limit identifiers. Readability and easy referencing of those bits of configuration across resources are a plus. In fact, while we are using the namespaced name of the RateLimitPolicy resource in the namespace field of the rate limit definition, only the name of the limit for this particular identifier suffices. Replacing the unsupported characters there won't be a problem.

All that to say that we don't need this PR. We can fix some other way in the RateLimitPolicy controller, in https://github.com/kuadrant/kuadrant-operator.

Thanks @didierofrivia and @alexsnaps! I think we can close this.

@didierofrivia didierofrivia deleted the new-condition-format branch July 27, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants